Conversation
| @Override | ||
| protected RecoveryStrategy getRecovery() { | ||
| Recovery rec = changeClass.getAnnotation(Recovery.class); | ||
| return rec != null ? rec.strategy() : RecoveryStrategy.MANUAL_INTERVENTION; |
There was a problem hiding this comment.
We should preserve the actual value(so when it's null, get the default value from the annotaiton). Otherwise, the test becomes misleading because it injects a default that production code might not apply.
Right now, @recovery defaults to MANUAL_INTERVENTION, so it happens to match the implicit default we’re injecting. But that’s fragile: if we ever change the annotation’s default in the future, this test will silently keep passing while no longer reflecting real behavior.
| public static ChangeValidator of(Class<?> changeClass) { | ||
| return new ChangeValidator(changeClass); | ||
| } |
There was a problem hiding this comment.
Ideally this is in the parent class, so in the future, when we add a potential validator for template-based changes, the user doesn't need to use a different class for constructor
There was a problem hiding this comment.
Aligned with this. We can rename the class. This becomes CodeBasedChangeValidator and the parent becomes ChangeValidator
Add ChangeValidator, a fluent test API to validate code-based Change contracts. Asserts annotation-derived metadata and structural invariants (id/author/order, flags). Validates target system routing, recovery strategy, and apply/rollback method presence.
Add ChangeValidator, a fluent test API to validate code-based Change contracts. Asserts annotation-derived metadata and structural invariants (id/author/order, flags). Validates target system routing, recovery strategy, and apply/rollback method presence.
feat: change validator